#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <algorithm>
#include <set>

using namespace std;
bool func(int val){
    return val > 2;
}

void test0(){
    vector<int> vec = {6, 1, 2, 3, 5, 8};

    /**
     * 删除所有大于5的元素
     * remove_if返回删除后的end指针
     * 还需要用erase才能彻底删除
     */
//    auto it = remove_if(vec.begin(), vec.end(), func);
    auto it = remove_if(vec.begin(), vec.end(), bind1st(less<int>(), 2));
    vec.erase(it, vec.end());

    for_each(vec.begin(), vec.end(), [](int& val){
        cout << val << " ";
    });

}

int main() {
    test0();

    return 0;
}
